<?php

/**
 * SocialEngine
 * 
 * @category   Application_Extensions
 * @package
 * @copyright  Copyright 2008-2012 YouNet Developments
 * @author     Anhtv
 */
class Mage_Book_Controller_Router extends Mage_Core_Controller_Varien_Router_Standard
{

    public function match(Zend_Controller_Request_Http $request)
    {
        if (parent::match($request)) return true;
        
        // CUSTOM ROUTE
        $path = trim($request->getPathInfo(), '/');

        if ($path) {
            $p = explode('/', $path);
        } else {
            $p = explode('/', $this->_getDefaultPath());
        }

        if (empty($p[0])) 
            return false;
        
        if ($p[0] == 'books' && empty($p[1]) )
        {
            $request->setModuleName('book')
                ->setControllerName('index')
                ->setActionName('browse');
            return true;
        }
        //@todo:
        
        return false;
    }

}
